import { _decorator, Component, Node,Animation,AnimationState } from 'cc';
import { AudioMgr } from '../../AudioMgr/AudioMgr';
const { ccclass, property } = _decorator;

@ccclass('DieEffect')
export class DieEffect extends Component {


    private ani:Animation=null;
    protected start(): void {
        this.ani=this.getComponent(Animation);

        this.ani.play("dieEffect");

        AudioMgr.Inst.playEffectSync("blast");
    
        this.ani.on(Animation.EventType.FINISHED, this.onAnimationEvent, this)
}

onAnimationEvent(type: Animation.EventType, state: AnimationState) {
     //console.log("anim over");
     this.node.destroy();
}

}


